POV-Ray : Newsgroups : povray.newusers : My first scene : My first scene Server Time
4 Nov 2024 23:17:46 EST (-0500)
  My first scene  
From: Frantisek Fuka
Date: 1 Sep 2002 14:28:19
Message: <3d725c43@news.povray.org>
Following is my first ever 3d scene. Could someone please give me 
pointers what could be done better, more elegantly?

Thanks
------------------------------

#include "colors.inc"
#include "arrays.inc"
camera {
     location <9,7,10>
     look_at <0,-5,0>
}
light_source { <10,10,20> color White*.6}
light_source { <10,10,10> color White}

#declare R1 = seed(666);

#macro Face_Dots (Dot_Array, rot)
     #local i = 0;
     #local to = dimension_size(Dot_Array,1) - 1;
     #if (to>0)
         merge {
     #else
         object {
     #end
     #while (i<=to)
         sphere {
             <Dot_Array[i][0],0,Dot_Array[i][1]>,
             0.55
         }
         #local i=i+1;
     #end
     pigment {White}
     finish {diffuse 0.5}
     scale .5
     translate y*1.2
     rotate rot
         }

#end

#macro Die(Pigment)
difference {
     intersection {
         box {
                 <-1,-1,-1>,
                 <1,1,1>
             }
         sphere {
             <0,0,0>,
             1.4
             }
         pigment {Pigment}
         finish {diffuse 0.4}
     }
     Face_Dots (array[6][2] {{1,1}, {0,1}, {-1,1}, {1,-1}, {0,-1}, 
{-1,-1}}, <0,0,0>)
     Face_Dots (array[1][2] {{0,0}}, <180,0,0>)
     Face_Dots (array[2][2] {{-1,-1}, {1,1}},<90,0,0>)
     Face_Dots (array[5][2] {{-1,-1}, {1,1}, {1,-1}, {-1,1}, 
{0,0}},<-90,0,0>)
     Face_Dots (array[3][2] {{-1,-1}, {0,0}, {1,1}},<0,0,-90>)
     Face_Dots (array[4][2] {{-1,-1}, {-1,1}, {1,-1}, {1,1}},<0,0,90>)
}
#end

#macro Rot (Seed)
     Rand_Array_Item (array[4] {0,90,180,270}, Seed)
#end

#local Size=5;
#local Spacing=2.1;
#local i=-Size;
#while (i<=Size)
     #local j=-Size;
     #while (j<=Size)
         object {
             Die (rgb<rand(R1),rand(R1),rand(R1)>)
             rotate <Rot(R1),Rot(R1),Rot(R1)>
             translate <i*Spacing,1+rand(R1),j*Spacing>
         }
         #local j=j+1;
     #end
     #local i=i+1;
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.